<?php

/**
 * Account form.
 *
 * @package    corpon
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class AccountForm extends BaseAccountForm
{
  public function configure()
  {
      unset($this['created_at']);
      $this->widgetSchema['shipping_state'] = new sfWidgetFormChoice(array('choices'  => Doctrine_Core::getTable('Account')->getStates(),'expanded' => false,));
      $this->widgetSchema['billing_state'] = new sfWidgetFormChoice(array('choices'  => Doctrine_Core::getTable('Account')->getStates(),'expanded' => false,));

      $years = range(date('Y')-30, date('Y')+10);
      $this->setWidget('contract_date',new sfWidgetFormJQueryDate(array('config' => '{firstDay: 1, changeMonth: true, changeYear: true}', 'culture' => 'en', 'date_widget' => new sfWidgetFormDate(array('years' => array_combine($years, $years), 'format' => '%month%%day%%year%' )))));
      $this->setWidget('contract_exp',new sfWidgetFormJQueryDate(array('config' => '{firstDay: 1, changeMonth: true, changeYear: true}', 'culture' => 'en', 'date_widget' => new sfWidgetFormDate(array('years' => array_combine($years, $years), 'format' => '%month%%day%%year%' )))));

      $this->widgetSchema['company_logo'] = new sfWidgetFormInputFile(array('label' => 'Company Logo',));
      $this->validatorSchema['company_logo'] = new sfValidatorFile(array('required' => false,'path' => sfConfig::get('sf_upload_dir').'/logos', 'max_size' => 4194304, 'mime_types' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif')),array('invalid' => 'Invalid File.', 'required'   => 'Choose a logo.', 'mime_types' => 'Format invalid. The file must be JPEG, PNG o GIF.', 'max_size' => 'Error Max size. The file is greater than 4MB.'));
  }
}
